package com.qf.fc.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.fc.dto.MoodDetail;
import com.qf.fc.entity.MoodLike;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 动态点赞表(MoodLike)表数据库访问层
 *
 * @author makejava
 * @since 2024-09-23 23:34:47
 */
public interface MoodLikeDao extends BaseMapper<MoodLike> {
    @Select("select m.*,ud.imageurl,ud.nickname,ml.create_time from t_mood_like ml inner join t_mood m on ml.mid=m.id inner join t_user_detail ud on m.uid=ud.uid where ml.uid=1 order by ml.create_time desc")
    List<MoodDetail> selectLikes(Integer uid);

    @Select("select count(*) from t_mood_like where uid=#{uid} and mid=#{mid}")
    int checkLike(@Param("uid") Integer uid, @Param("mid") Integer mid);
}

